SET(MODULE_NAME tsinIDE)

FIND_PACKAGE(Qt4)

INCLUDE(${QT_USE_FILE})
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
ADD_DEFINITIONS(${QT_DEFINITIONS})

FILE(GLOB PREMOC_HEADERS ${PROJECT_SOURCE_DIR}/include/tsinide/*.hpp)
FILE(GLOB FILES ${PROJECT_SOURCE_DIR}/src/tsinide/*.cpp)
FILE(GLOB FORMS ${PROJECT_SOURCE_DIR}/src/tsinide/*.ui)
SET(RESOURCE_FILE ${PROJECT_SOURCE_DIR}/resources.qrc)

IF(WIN32)
SET(RC_FILES res.rc)
ENDIF()

QT4_WRAP_CPP(HEADERS_MOC ${PREMOC_HEADERS})
QT4_WRAP_UI(FORMS_HEADER ${FORMS})
QT4_ADD_RESOURCES(RESOURCES ${RESOURCE_FILE})

SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR})

ADD_EXECUTABLE(${MODULE_NAME} ${EXECUTABLE_ATTR}
               ${FILES} ${RC_FILES} ${PREMOC_HEADERS} ${RESOURCE_FILE}
               ${HEADERS_MOC} ${FORMS_HEADER} ${RESOURCES})
SET_TARGET_PROPERTIES(${MODULE_NAME} PROPERTIES PREFIX "")
SET_TARGET_PROPERTIES(${MODULE_NAME} PROPERTIES OUTPUT_NAME "tsinIDE")
TARGET_LINK_LIBRARIES(${MODULE_NAME} ${QT_LIBRARIES} ${QT_QTMAIN_LIBRARY})
INSTALL(TARGETS tsinIDE DESTINATION .)
